<?php
require_once('lib/utils.php');
require_once('lib/agenda.php');

?>
<script src="pages_admin/club/_club.js" type="text/javascript"></script>
<script src="javascript/jquery/jquery.ui.datepicker-fr.js" type="text/javascript"></script>
<h3>Agenda du bureau</h3>
<div id="club_agenda">
	<p class="refresh"><a href="javascript:window.location.reload();">Actualiser la page</a></p>
	<p class="add"><a href="javascript:void(0);" id="open_agenda_add">Ajouter une entrée</a></p>
	<?php
	$param_nb_entries = appparam_get('AGENDA_NB_ENTRY');
	$param_nb_entries = $param_nb_entries['value'];
	$nb_entries = isset($_POST['nbnews']) ? $_POST['nbnews'] : $param_nb_entries;
	$entries = agenda_get_list($nb_entries);
	?>
	<div class="ajax2"></div>
	<p><strong>Légende :</strong><br /><span style="color: #0000ff;">bleu</span> = r&eacute;unions Adr&eacute;naline<br /><span style="color: #ff0000;">rouge</span> = concerne les mairies<br /><span style="color: #339966;">vert</span> = autre</p>
	
	<form method="post" action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>">
		<p>
		<label for="nbnews">&nbsp;Nombre d'entrées à afficher :&nbsp;</label>
		<select name="nbnews" id="nbnews">
			<option value="<?php echo $param_nb_entries ?>" <?php echo $nb_entries == $param_nb_entries ? 'selected="selected"' : '' ?>>
				<?php echo $param_nb_entries ?>
			</option>
			<option value="<?php echo $param_nb_entries*2 ?>" <?php echo $nb_entries == $param_nb_entries*2 ? 'selected="selected"' : '' ?>>
				<?php echo $param_nb_entries*2 ?>
			</option>
			<option value="<?php echo $param_nb_entries*3 ?>" <?php echo $nb_entries == $param_nb_entries*3 ? 'selected="selected"' : '' ?>>
				<?php echo $param_nb_entries*3 ?>
			</option>
			<option value="<?php echo $param_nb_entries*4 ?>" <?php echo $nb_entries == $param_nb_entries*4 ? 'selected="selected"' : '' ?>>
				<?php echo $param_nb_entries*4 ?>
			</option>
			<option value="0" <?php echo $nb_entries == 0 ? 'selected="selected"' : '' ?>>
				Toutes&nbsp;
			</option>
		</select>
		<input class="hidden" type="submit" name="go" id="go" value="" />
		</p>
	</form>
	<br />
	<?php
	while($entry = mysql_fetch_assoc($entries)) {
		echo '<p class="entry"><span id="entry_'.$entry['id'].'" class="'.$entry['icon'].'"></span>'.date_to_str($entry['date']).' : '.$entry['content'].'</p>';
	}
	?>
</div>

<div id="agenda_add" class="hidden">
	<form method="post" action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI']); ?>">
	<fieldset>
		<label for="date">Date</label>
        <input type="text" name="date" id="date" class="text ui-widget-content ui-corner-all" />
        <input type="hidden" name="real_date" id="real_date" />
		
		<label for="content">Libellé</label>
        <input type="text" name="content" id="content" class="text ui-widget-content ui-corner-all" />
		
		<p class="decalhautdouble alignleft">
		<span>Couleur icone</span><br />
        <select name="icon" id="icon" class="ui-widget-content">
			<option value="bdot">Bleu : réunions Adrénaline</option>
			<option value="rdot">Rouge : les mairies</option>
			<option value="gdot">Vert : Autre</option>
		</select>
		</p>
	</fieldset>
	</form>
	<div class="ajax"></div>
</div>
